home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
- * Default curve drawing routine common to graphics drivers. *
- * *
- * Written by: Gershon Elber Ver 0.1, June 1993. *
- *****************************************************************************/
-
- #include "irit_sm.h"
- #include "iritprsr.h"
- #include "allocate.h"
- #include "ip_cnvrt.h"
- #include "cagd_lib.h"
- #include "iritgrap.h"
-
- /****************************************************************************
- * Draw a single Curve object using current modes and transformations. *
- * Curve must be with either E3 or P3 point type and must be NURB. *
- * Control points in SGI's format must be found in "_ctlpoints" attribute. *
- ****************************************************************************/
- void IGDrawCurve(IPObjectStruct *PObj)
- {
- IPObjectStruct *PObjPolylines, *PObjCtlPolys;
-
- if ((PObjPolylines = AttrGetObjectObjAttrib(PObj, "_isoline")) == NULL) {
- CagdCrvStruct *Crv,
- *Crvs = PObj -> U.Crvs;
- IPPolygonStruct *PPolyline;
-
- PObjPolylines = IPAllocObject("", IP_OBJ_POLY, NULL);
- PObjPolylines -> Attrs = AttrCopyAttributes(PObj -> Attrs);
- IP_SET_POLYLINE_OBJ(PObjPolylines);
- for (Crv = Crvs; Crv != NULL; Crv = Crv -> Pnext) {
- PPolyline = IritCurve2Polylines(Crv, IGGlblSamplesPerCurve);
-
- PPolyline -> Pnext = PObjPolylines -> U.Pl;
- PObjPolylines -> U.Pl = PPolyline;
- }
- AttrSetObjectObjAttrib(PObj, "_isoline", PObjPolylines);
- }
- IGDrawPoly(PObjPolylines);
-
- if (IGGlblDrawSurfaceMesh) {
- if ((PObjPolylines = AttrGetObjectObjAttrib(PObj, "_ctlpoly"))
- == NULL) {
- CagdCrvStruct *Crv,
- *Crvs = PObj -> U.Crvs;
- IPPolygonStruct *PCtlPoly;
-
- PObjCtlPolys = IPAllocObject("", IP_OBJ_POLY, NULL);
- PObjCtlPolys -> Attrs = AttrCopyAttributes(PObj -> Attrs);
- IP_SET_POLYLINE_OBJ(PObjCtlPolys);
- for (Crv = Crvs; Crv != NULL; Crv = Crv -> Pnext) {
- PCtlPoly = IritCurve2CtlPoly(Crv);
-
- PCtlPoly -> Pnext = PObjCtlPolys -> U.Pl;
- PObjCtlPolys -> U.Pl = PCtlPoly;
- }
- AttrSetObjectObjAttrib(PObj, "_ctlpoly", PObjCtlPolys);
- }
-
- IGDrawPoly(AttrGetObjectObjAttrib(PObj, "_ctlpoly"));
- }
- }
-